-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Remove unnecessary join when filtering on relationship id #3922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
6042c1e
to
12cfabd
Compare
// is the attribute of Collection type? | ||
boolean isPluralAttribute = model instanceof PluralAttribute; | ||
|
||
if (propertyPathModel == null && isPluralAttribute) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
propertyPathModel being null is no longer issue in hibernate
Thanks a lot. Does this optimization also work for composite id's and/or parts of a composite identifier? |
It should. I've added some more tests. Unfortunately
Test also fails without my changes to query utils |
Looks like a Hibernate issue. The query is:
Exception (it's a masked
I've reproduced the issue just using Also, noteworthy, when introducing |
Closes spring-projects#3349 Signed-off-by: Jakub Soltys <[email protected]>
I am not sure from the last comment whether there is something that I should change to move this PR forward? |
If you want, please report the problem to the Hibernate team using code from the reproducer. Hibernate folks are somewhat picky and want folks to use their reproducer templates. In recent reports, the moment the've seen Spring being involved, they backed off immediately and so I am tired filing bug reports there. Rather, I focus on investigating the cause to see whether there is something we can fix on our side (which we can't). Circling back to the original request, I suggest to wait for a Hibernate fix before we proceed. Shipping a feature where composite Id's cannot be used feels like an incomplete feature from our side. |
Ok I will try to report it using their template, although I feel what you are saying. |
Technically, it isn't a blocker, but once we're going to advertise the feature it receives more attention and specific cases are going to fail creating a hard time for users wanting to use the feature. Let's get some indication from the Hibernate team how it goes to get a better understanding of how and when we can progress. |
Hibernate issue is fixed in versions 6.6.24 and 7.0.9. |
We now no longer create a join for query property paths that point to an identifier of referenced entities to optimize query creation. Closes #3349 Original pull request: #3922 See also: #3970 Signed-off-by: Jakub Soltys <[email protected]>
Thank you for your contribution. That's merged and polished now. I left a comment at #3970 to explain how we went about two contributions for the same topic and why we decided to use this PR as base for the merge. |
Thanks! PS: I guess you meant #3970 :) |
Indeed, good catch, updated the reference. |
- Move tests from separate file to QueryUtilsIntegrationTests - Move isAnyAnnotatedProperty method to appropriate location - Follow PR spring-projects#3922 pattern for test structure - Simplify code and remove unnecessary comments Signed-off-by: Hyunjoon Park <[email protected]> Signed-off-by: academey <[email protected]>
Closes #3349